/**
 * 
 */
package com.seedwill.common.meta.result;

import java.util.ArrayList;
import java.util.List;

/**
 * 带返回信息的结果
 * @author kdyi
 *
 */
public class MessageResult extends Result {

	/**
	 * 
	 */
	public MessageResult() {
		super();
	}
	public MessageResult(boolean f) {
		super(f);
	}
	public MessageResult(boolean f, Object rtn) {
		super(f, rtn);
	}
	public MessageResult(boolean f, Object rtn, String msg) {
		super(f, rtn);
		mainMessage = msg;
	}
	
	public MessageResult(boolean f, Object rtn, String msg, List aMessages) {
		super(f, rtn);
		mainMessage = msg;
		attachedMessages = aMessages;
	}
	
	/**
	 * 附加附属信息
	 * @param msg
	 */
	@SuppressWarnings("unchecked")
	public void addAttachedMessage(String msg){
		if(attachedMessages == null){
			attachedMessages = new ArrayList();
		}
		attachedMessages.add(msg);
	}
	
	/**
	 * 主要信息
	 */
	protected String mainMessage;
	/**
	 * 附属信息
	 */
	protected List attachedMessages;
	
	public List getAttachedMessages() {
		return attachedMessages;
	}
	public void setAttachedMessages(List attachedMessages) {
		this.attachedMessages = attachedMessages;
	}
	public String getMainMessage() {
		return mainMessage;
	}
	public void setMainMessage(String mainMessage) {
		this.mainMessage = mainMessage;
	}
}
